﻿using Blog.Huge.Core;
using System.Collections.Generic;
using Blog.Huge.Core.DataInterfaces;
using System.Web.Mvc;
using SharpArch.Core;
using SharpArch.Web;

namespace Blog.Huge.Web.Controllers
{
    public class PostsController: Controller
    {
        public PostsController(IPostRepository postRepository)
        {
            Check.Require(postRepository!=null, "Post Repository may not be null");
            this.postRepository = postRepository;
   
        }

        public ActionResult ListPostsMatching(string filter)
        {
            List<Post> posts = this.postRepository.FindAllMatching(filter);
            return View("ListPostsMatchingFilter", posts);
        }

        private readonly IPostRepository postRepository;
    }
}